// Example of using heap functions to find max and min sizes in a vector and also sort a vector.
// Date 12/10/2018
// By Ben

#include <iostream>
#include <algorithm>
#include <vector>

using namespace std;
using std::cout;
using std::endl;
using std::cin;

int main(int argc, char *argv[]){
	vector<int>vec;

	vec.push_back(10);
	vec.push_back(50);
	vec.push_back(12);
	vec.push_back(5);
	//Make heap to find largest and lowest
	make_heap(vec.begin(), vec.end());

	std::cout << "Max : " << vec.front() << endl;
	std::cout << "Min : " << vec.back() << endl;

	//Sort vector
	sort_heap(vec.begin(), vec.end());

	std::cout << "Sorted vector: " << endl;
	//Output sorted vector
	for (int i = 0; i < vec.size(); i++){
		std::cout << vec[i] << " ";
	}

	std::cout << endl;

	vec.clear();

	system("pause");
	return 0;
}